<!-- 搜索 -->
<template>
  <div>
    <el-input
      v-show="isShow"
      size="medium"
      placeholder="🔍  搜索"
      v-model="input"
      class="search-input"
      @keyup.enter.native="toSearchView"
    >
      <el-button
        slot="append"
        icon="el-icon-search"
        @click="toSearchView"
      ></el-button>
    </el-input>
  </div>
</template>

<script>
export default {
  data() {
    return {
      input: "",
    };
  },
  computed: {
    isShow: function () {
      //let curPath = this.$route.path;
      return true;
      // return (
      //   curPath == "/home/photo" ||
      //   curPath == "/home/person" ||
      //   curPath == "/home/theme"
      // );
    },
  },
  methods: {
    toSearchView() {
      this.$router.push({
        path: "/home/search",
        query: {
          input: this.input,
        },
      });
      // if (this.$route.path != "/home/search") {
      //   this.$router.push({
      //     path: "/home/search",
      //     query: {
      //       input: this.input,
      //     },
      //   });
      //   this.input = "";
      // }else{
      //   console.log(this.$route.query );

      //   console.log('不调整',this.input);
      // }
    },
  },
};
</script>

<style  scoped>
.search-input {
  width: 300px;
  align-self: flex-end;
  margin-top: 5px;
  margin-right: -5px;
  border-radius: 10px;
}
</style>
